﻿Public Class HangSanXuat
    Public Shared Function them(ByVal tenhang As String, ByVal quocgia As String, ByVal website As String) As Boolean
        tenhang = EscapeString(tenhang)
        quocgia = EscapeString(quocgia)
        website = EscapeString(website)
        Return db.Query("INSERT INTO  HangSanXuat(TenHang,QuocGia,Website) VALUES(N'" + tenhang + "',N'" + quocgia + "','" + website + "')")
    End Function
    Public Shared Function dshsx() As DataTable
        Return db.QueryTable("SELECT * FROM HangSanXuat")
    End Function
    Public Shared Function capnhat(ByVal mahang As String, ByVal tenhang As String, ByVal quocgia As String, ByVal website As String) As Boolean
        mahang = EscapeString(mahang)
        tenhang = EscapeString(tenhang)
        quocgia = EscapeString(quocgia)
        website = EscapeString(website)
        Return db.Query("UPDATE HangSanXuat SET TenHang = N'" + tenhang + "',QuocGia = N'" + quocgia + "',Website = '" + website + "'WHERE MaHang = '" + mahang + "'")
    End Function
    Public Shared Function timkiem(ByVal tukhoa As String) As DataTable
        tukhoa = EscapeString(tukhoa)
        Return db.QueryTable("SELECT * FROM HangSanXuat WHERE MaHang like '%" & tukhoa & "%' or TenHang like '%" & tukhoa & "%'or QuocGia like '%" & tukhoa & "%' or Website like '%" & tukhoa & "%'")
    End Function
    Public Shared Function xoa(ByVal mahang As String) As Boolean
        mahang = EscapeString(mahang)
        Return db.Query("DELETE FROM HangSanXuat WHERE MaHang ='" + mahang + "'")
    End Function
End Class
